<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>银行卡管理</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-4">
    <h2>银行卡管理</h2>
    <form class="row g-3 mb-3" method="get">
        <div class="col-auto">
            <input type="text" class="form-control" name="cardID" placeholder="卡号" value="{{ cardID }}">
        </div>
        <div class="col-auto">
            <input type="text" class="form-control" name="customerID" placeholder="客户ID" value="{{ customerID }}">
        </div>
        <div class="col-auto">
            <input type="text" class="form-control" name="isReportLoss" placeholder="挂失状态" value="{{ isReportLoss }}">
        </div>
        <div class="col-auto">
            <button type="submit" class="btn btn-primary">查询</button>
            <a href="{{ url_for('admin_card_add') }}" class="btn btn-success">新增银行卡</a>
            <a href="{{ url_for('admin_index') }}" class="btn btn-secondary">返回</a>
        </div>
    </form>
    {% with messages = get_flashed_messages() %}
      {% if messages %}
        <div class="alert alert-info">{{ messages[0] }}</div>
      {% endif %}
    {% endwith %}
    <table class="table table-bordered table-hover">
        <thead>
            <tr>
                <th>卡号</th>
                <th>币种ID</th>
                <th>存款类型ID</th>
                <th>开户日期</th>
                <th>开户金额</th>
                <th>余额</th>
                <th>挂失状态</th>
                <th>客户ID</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
        {% for c in cards %}
            <tr>
                <td>{{ c.cardID }}</td>
                <td>{{ c.curID }}</td>
                <td>{{ c.savingID }}</td>
                <td>{{ c.openDate }}</td>
                <td>{{ c.openMoney }}</td>
                <td>{{ c.balance }}</td>
                <td>{{ c.IsReportLoss }}</td>
                <td>{{ c.customerID }}</td>
                <td>
                    <a href="{{ url_for('admin_card_edit', cardID=c.cardID) }}" class="btn btn-sm btn-warning">编辑</a>
                    <form action="{{ url_for('admin_card_delete', cardID=c.cardID) }}" method="post" style="display:inline-block;" onsubmit="return confirm('确定要删除该银行卡吗？');">
                        <button type="submit" class="btn btn-sm btn-danger">删除</button>
                    </form>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
</div>
</body>
</html> 